package com.cifer.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
//笔记：
//java请求响应，get、post请求区别不大，就结果来说区别不大，都能在请求体中设置要发送的json数据
@Controller
public class TestController {
    @GetMapping("/jsonTest")
    public int accept(@RequestBody User user){
        System.out.println(user.name+user.age);
        return 1;
    }
}

class User{
    String name;
    int age;
    public User(String name,int age){
        this.name=name;
        this.age=age;
    }
}